# -*- coding: utf-8 -*-
# @Time    : 2022/7/20 10:24
# @Author  : Yanfeng
# @Email   : sxyanfeng2014@163.com
# @File    : __init__.py.py
# @Software: PyCharm
import os


def get_all_files(file_path, yaml_data_switch=False) -> list:
    """
    获取文件路径
    :param file_path: 目录路径
    :param yaml_data_switch: 是否过滤文件为 yaml格式， True则过滤
    :return:
    """
    filename = []
    # 获取所有文件下的子文件名称
    for root, dirs, files in os.walk(file_path):
        for filePath in files:
            path = os.path.join(root, filePath)
            if yaml_data_switch:
                if 'yaml' in path or '.yml' in path:
                    filename.append(path)
            else:
                filename.append(path)
    return filename

if __name__ == '__main__':
    # print(get_all_files(r"D:\zhcx-erp-web-autotest\commonUtils"))
    # get_all_files(r"D:\zhcx-erp-web-autotest\Outouts\report\html\data\test-cases")
    for root, dirs, files in os.walk(r"D:\zhcx-erp-web-autotest\Outouts\report\html\data\test-cases"):
        print("第一行",root)
        print("第二行",dirs)
        print("第三行",files)